
import { StackNavigator,TabNavigator,DrawerNavigator } from 'react-navigation';
import React, {Component} from 'react';
import {
    Dimensions,
    Text,
    View
} from 'react-native';
import Tab from './MyTabNav'
import HomeScreen from '../src/HomeScreen'
import ChatScreen from '../src/ChatScreen'
import MyHomeScreen from '../src/MyHomeScreen'
const windowWidth = Dimensions.get('window').width;
const windowHeight = Dimensions.get('window').height;
//跳转路由 与之前的路由功能一致
const nav=StackNavigator(
  {
    Tab:{screen:Tab},//tab路由
    MyHomeScreen:{screen:MyHomeScreen},//具有路由功能的页面 其他单页面也可以在这里进行配置
  },
  {
    navigationOptions:{ //通用配置 参考 https://reactnavigation.org/docs/navigators 属性
      headerBackTitle:null,
      headerTintColor:'#333333',
      showIcon:true,
      swipeEnabled:false,
      animationEnabled:false,
    },
    mode:'card',
  });
//侧边栏View
const CustomDrawerContentComponent=()=>{
  return (
    <View style={{flex:1,backgroundColor:'green',paddingTop:20,alignItems: 'center',justifyContent: 'center',}}>
      <Text style={{color:'#fff',fontSize:14}}>自定义侧边栏</Text>
    </View>
  )
}
//侧边栏 三者嵌套关系：侧边栏->跳转->选项卡 （DrawerNavigator->StackNavigator->TabNavigator）
export default DrawerNavigator({
       nav: { screen: nav }
   }, {
       drawerWidth: windowWidth*3/4, // 抽屉宽
       drawerPosition: 'left', // 抽屉在左边还是右边
       contentComponent: CustomDrawerContentComponent,  // 自定义抽屉组件
       contentOptions: {
         initialRouteName: nav, // 默认页面组件
       }
   });
